package com.qianxp.authorize.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qianxp.authorize.entity.User;
import com.qianxp.authorize.mapper.UserMapper;
import com.qianxp.authorize.service.IUserService;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class UserService extends ServiceImpl<UserMapper, User> implements IUserService {
    public List<User> getUserByName(String username){
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(User::getRealname,username);
        return baseMapper.selectList(queryWrapper);
    }


    public IPage<User> selectUserPage(int current,int size) {
        Page<User> page = new Page<>(current,size);
        return baseMapper.selectPage(page,new QueryWrapper<>());
    }
}
